<?php
class My_Acl extends Zend_Acl
{
	public function __construct(Zend_Auth $auth)
	{
		// add Resource
		$this->add(new Zend_Acl_Resource('admin'));
		$this->add(new Zend_Acl_Resource('front'));
		$this->add(new Zend_Acl_Resource('user'));
		// admin
		$this->add(new Zend_Acl_Resource('admin:index'),'admin');
		$this->add(new Zend_Acl_Resource('admin:account'),'admin');
		$this->add(new Zend_Acl_Resource('admin:menu'),'admin');
		$this->add(new Zend_Acl_Resource('admin:schedule'),'admin');
		$this->add(new Zend_Acl_Resource('admin:order'),'admin');
		$this->add(new Zend_Acl_Resource('admin:topup'),'admin');
		$this->add(new Zend_Acl_Resource('admin:statistic'),'admin');
		// front
		$this->add(new Zend_Acl_Resource('front:index'),'front');
		$this->add(new Zend_Acl_Resource('front:authentication'),'front');
		$this->add(new Zend_Acl_Resource('front:utils'),'front');
		// user
		$this->add(new Zend_Acl_Resource('user:index'),'user');

		// add Role
		$this->addRole(new Zend_Acl_Role('front'))
			->addRole(new Zend_Acl_Role('user'))
			->addRole(new Zend_Acl_Role('admin'));

		// add
		
		$this->allow('user');
		$this->allow('front');

		$this->deny('user','admin');
		//$this->deny('user','admin:index',array('index'));

		$this->deny('front','admin');
		//$this->deny('front','admin:index',array('index'));

		$this->deny('front','user');
		//$this->deny('front','user:index',array('index'));
		$this->allow('front', 'user:index', 'schedule');
		$this->allow('admin');

		//		$this->deny('user','admin');
		//		$this->deny('user','admin:index',array('index'));
		//
		//		$this->deny('front','admin');
		//		$this->deny('front','admin:index',array('index'));
	}
}
?>
